package clases;

import java.util.StringTokenizer;

public class Datos extends Base 
{   
    public double NombreCategorias(String Cad)
    {
    	String temp = "";    	
    	int pos = 0;
    	val = 0;
    	StringTokenizer Separa = new StringTokenizer(Cad, "}");
    	while (Separa.hasMoreElements()) 
    	{
    		temp = Separa.nextToken(); 
    		//if(!temp.contains("Cod_Tipo"))
    		//{
	    		StringTokenizer UPS = new StringTokenizer(temp, "|");
	    		while (UPS.hasMoreElements()) 
	        	{
	        		temp = UPS.nextToken();        		
		        		switch(pos)
		        		{
			        		case 0: NomCat[val][0][0]= temp.replace(" ", "");
			        			break;
			        		case 1: NomCat[val][1][0]= temp.replace(" ", " ");
		        				break;
			        		case 2: 
			        			try
			        			{
			        				NomCat[val][0][1]= temp.replace(" ", "");
			        			}
			        			catch(Exception Ex)
			        			{
			        				NomCat[val][0][1]= "";
			        			}
		    					break;
		        		}		        		
		        		pos = pos + 1;
	        		}	    		
	    			pos = 0;
	    			val = val + 1 ;
	        	//}    		
    	}
    	return val;
    }
    
    public double ModificarArticulos(String Cad)
    {
    	String temp = "";    	
    	int pos = 0;
    	val = 0;
    	StringTokenizer Separa = new StringTokenizer(Cad, "}");
    	while (Separa.hasMoreElements()) 
    	{
    		temp = Separa.nextToken();   
    		//if(!temp.contains("Sesion"))
    		//{
	    		StringTokenizer UPS = new StringTokenizer(temp, "|");
	    		while (UPS.hasMoreElements()) 
	        	{
	        		temp = UPS.nextToken();        		
	        		switch(pos)
	        		{
	        					//SKU
	        			case 0: NomCat[val][0][0] = temp;
	        				break;
	        					//Descripcion
		        		case 1: NomImg[val][1] = temp;
		        			break;
		        				//Precio
		        		case 2: NomCat[val][1][0] = temp;
	        				break;
	        					//Imagen
		        		case 3: NomImg[val][0] = temp.replace(" ", "");
							break;
	        					//Cantidad
		        		case 4: NomCat[val][0][1] = temp.replace(" ", "");
	    					break;    						
	        		}
	        		pos = pos + 1;
	        	}    		
	    		pos = 0;
	    		val = val + 1 ;
    		//}
    	}
    	return val;
    }
    
    public double ListadoArticulos(String Cad)
    {
    	String temp = "";    	
    	int pos = 0;
    	val = 0;
    	StringTokenizer Separa = new StringTokenizer(Cad, "}");
    	while (Separa.hasMoreElements()) 
    	{
    		temp = Separa.nextToken();   
    		//if(!temp.contains("Sesion"))
    		//{
	    		StringTokenizer UPS = new StringTokenizer(temp, "|");
	    		while (UPS.hasMoreElements()) 
	        	{
	        		temp = UPS.nextToken();        		
	        		switch(pos)
	        		{
        					//SKU
	        			case 0: NomCat[val][0][0] = temp;
	        				break;
	        					//Descripcion
		        		case 1: NomImg[val][1] = temp;
		        			break;
		        				//Precio
		        		case 2: NomCat[val][1][0] = temp;
	        				break;
	        					//Imagen
		        		case 3: NomImg[val][0] = temp.replace(" ", "");
							break;
	        					//Cantidad
		        		case 4: NomCat[val][0][1] = temp.replace(" ", "");
	    					break;    						
	        		}
	        		pos = pos + 1;
	        	}    		
	    		pos = 0;
	    		val = val + 1 ;
    		//}
    	}
    	return val;
    }
    
    public double ListadoPedidos(String Cad)
    {
    	String temp = "";    	
    	int pos = 0;
    	val = 0;
    	StringTokenizer Separa = new StringTokenizer(Cad, "}");
    	while (Separa.hasMoreElements()) 
    	{
    		temp = Separa.nextToken();    		
    		StringTokenizer UPS = new StringTokenizer(temp, "|");
    		while (UPS.hasMoreElements()) 
        	{
        		temp = UPS.nextToken();        		
        		switch(pos)
        		{
	        		case 0: NomCatg[val][0] = temp.replace(" ", "");
	        			break;
	        		case 1: NomCatg[val][1] = temp.replace(" ", " ");
        				break;
	        		case 2: NomImgs[val][0][0] = temp.replace(" ", "");
    					break;
	        		case 3: NomImgs[val][1][0] = temp.replace(" ", "");
						break;					
	        		case 4: NomImgs[val][0][1] = temp.replace(" ", "");
						break;
	        		case 5: NomFact[val][0][0] = temp.replace(" ", "");
						break;
	        		case 6: NomFact[val][1][0] = temp.replace(" ", "");
						break;
	        		case 7: NomFact[val][0][1] = temp.replace(" ", "");
						break;
        		}
        		pos = pos + 1;
        	}    		    		
    		pos = 0;
    		val = val + 1 ;
    	}
    	return val;
    }
    
    public double DetallePedidos(String Cad)
    {
    	String temp = "";    	
    	int pos = 0;
    	val = 0;
    	StringTokenizer Separa = new StringTokenizer(Cad, "}");
    	while (Separa.hasMoreElements()) 
    	{
    		temp = Separa.nextToken();    		
    		StringTokenizer UPS = new StringTokenizer(temp, "|");
    		while (UPS.hasMoreElements()) 
        	{
        		temp = UPS.nextToken();        		
        		switch(pos)
        		{
	        		case 0: NomCatg[val][0] = temp.replace(" ", "");
	        			break;
	        		case 1: NomCatg[val][1] = temp.replace(" ", " ");
        				break;
	        		case 2: NomImgs[val][0][0] = temp.replace(" ", "");
    					break;
	        		case 3: NomImgs[val][1][0] = temp.replace(" ", "");
						break;					
	        		case 4: NomImgs[val][0][1] = temp.replace(" ", "");
						break;
	        		case 5: NomFact[val][0][0] = temp.replace(" ", "");
						break;
	        		case 6: NomFact[val][1][0] = temp.replace(" ", "");
						break;
	        		case 7: NomFact[val][0][1] = temp.replace(" ", "");
						break;
        		}
        		pos = pos + 1;
        	}    		    		
    		pos = 0;
    		val = val + 1 ;
    	}
    	return val;
    }
}
